package com.foreknow.demo5;

import java.util.Scanner;

/**
 * 方法的参数和返回值类型也可以是自定义类类型
 * 1.如果方法的返回值类型为类类型，那么return 后面一定是一个对象(new 创建的才是对象)
 *  在实际应用中如果从数据库中查询到一条数据就可以用对象来保存。
 */
public class Manager {
    public Student getQueryById(){
        Student aa = new Student();
        aa.name = "tom";
        aa.age = 17;
        return aa;
    }
    public Student add(Student s){
        Student s1 = new Student();
        return s1;
    }



    public static void main(String[] args) {
        Manager manager = new Manager();
        Student stu = manager.getQueryById();

        Scanner input = new Scanner(System.in);
        System.out.println("输入学生姓名：");
        String name = input.next();
        System.out.println("输入学生年龄：");
        int age = input.nextInt();
        System.out.println("输入学生学号：");
        String sid = input.next();
        System.out.println("输入学生学校：");
        String school = input.next();

        Student s = new Student();
        s.name = name;
        s.age = age ;
        s.id = sid;
        s.school = school;
        manager.add(s);
    }
}
